package top.huhuiyu.springboot3.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import top.huhuiyu.springboot3.validate.CommonValidate;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

@Data
public class TestInfo implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    @NotNull(message = "整数值必须填写", groups = {CommonValidate.Insert.class})
    @Min(value = 1, message = "整数值必须大于0", groups = {CommonValidate.Insert.class})
    @Max(value = 100, message = "整数值必须小于100", groups = {CommonValidate.Insert.class})
    private Integer iv;
    @NotBlank(message = "字符串值必须填写", groups = {CommonValidate.Insert.class, CommonValidate.Update.class})
    private String sv;
    private Double dv;
    @NotNull(message = "日期必须填写", groups = {CommonValidate.Insert.class})
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date date;
}
